from json_rpc11 import JSONHandler
from pprint import pprint
import json

x = JSONHandler()
x.register_introspection()

def pow(x, y):
    '''
    get the pow of two numbers
    '''
    return x ** y

x.register_function(pow)

pprint(x.handle_call('{ "method": "echo", "params": ["Hello JSON-RPC"], "id": 1, "version" : "1.1"}'))

pprint(x.handle_call('{ "method": "pow", "params": [5, 3], "id": 1, "version" : "1.1"}'))

pprint(json.loads(x.handle_call('{ "method": "system.describe", "params": [], "id": 1, "version" : "1.1"}')))
